package com.darrenchan.leetcode;

/**
 * @Desc
 * @Author chenchi03
 * @CreateTime 2019-11-27 00:29
 */
public class Q557 {
    public String reverseWords(String s) {
        String[] strings = s.split(" ");
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < strings.length - 1; i++) {
            sb.append(new StringBuilder(strings[i]).reverse());
            sb.append(" ");
        }
        sb.append(new StringBuilder(strings[strings.length - 1]).reverse());
        return sb.toString();
    }
    public static void main(String[] args) {
        System.out.println(new Q557().reverseWords("Let's take LeetCode contest"));
    }
}
